#include<bits/stdc++.h>

using namespace std;

bool cmp(pair<int, int> x, pair<int, int> y) {
    if (x.first != y.first)return x.first > y.first;
    return x.second > y.second;
}

int main() {
    vector<pair<int, int>> p;
    for (int i = 0; i < 10; i++) {
        p.push_back(make_pair(rand() % 100, rand() % 100));
    }
    for (auto &e:p)cout << e.first << " " << e.second << endl;
    sort(p.begin(), p.end(), cmp);
    cout << endl;

    for (auto &e:p)cout << e.first << " " << e.second << endl;
    return 0;
}
